#!/usr/bin/expect

spawn build/bin/observer -f etc/observer.ini -P cli 
# expect "miniob >"
# send "drop table t_order_by;\r"
# expect "miniob >"
# send "drop table t_order_by_2;\r"
# expect "miniob >"
# send "drop table t_order_by_3;\r"
# expect "miniob >"
# send "create table t_order_by(id int, score float, name char(4));\r"
# expect "miniob >"
# send "create table t_order_by_2(id int, age int, name char(4));\r"
# expect "miniob >"
# send "create table t_order_by_3(id int, age int, name char(4));\r"
# expect "miniob >"
# send "insert into t_order_by values(3, 1.0, 'a');\r"
# expect "miniob >"
# send "insert into t_order_by values(10001, 1000.0, 'b');\r"
# expect "miniob >"
# send "insert into t_order_by values(4, 3.0, 'c');\r"
# expect "miniob >"
# send "insert into t_order_by_2 values(3, 1.0, 'ac');\r"
# expect "miniob >"
# send "insert into t_order_by_2 values(1000, 1000.0, 'b');\r"
# expect "miniob >"
# send "insert into t_order_by_2 values(445, 3.0, 'cd');\r"
# expect "miniob >"
# send "insert into t_order_by_3 values(34, 1.0, 'ab');\r"
# expect "miniob >"
# send "insert into t_order_by_3 values(10, 100.0, 'cs');\r"
# expect "miniob >"
# send "insert into t_order_by_3 values(4475, 3.0, 'cd');\r"
# expect "miniob >"
# send "select * from t_order_by, t_order_by_2;\r"
# expect "miniob >"
# send "select * from t_order_by where score > (select max(id) from t_order_by_2)\r"
# expect "miniob >"
# send "select * from t_order_by where id not in (select id from t_order_by_2)\r"
# expect "miniob >"
# send "select * from t_order_by where score in (select id from t_order_by_2)\r"
# expect "miniob >"
# send "select * from t_order_by where name in (select name from t_order_by_2)\r"
# expect "miniob >"
# send "select * from t_order_by where name > (select min(name) from t_order_by_2)\r"
# expect "miniob >"
# send "select * from t_order_by where name in (select name from t_order_by_2 where name >(select min(name) from t_order_by_3))\r"
expect "miniob >"
send "select * from t_order_by where id < (select min(t_order_by_2.id) from t_order_by_2 where 1=0)\r"
expect "miniob >"
send "select * from t_order_by where id = (select t_order_by_2.id from t_order_by_2 )\r"
expect "miniob >"
send "select * from t_order_by where id = (select id, name from t_order_by_2 )\r"
expect "miniob >"
send "select * from t_order_by where id = (select * from t_order_by_2 )\r"
expect "miniob >"
send "select * from t_order_by where id in (select t_order_by_2.id from t_order_by_2 );\r"
interact
